#!/usr/bin/env perl

#匹配操作
$bar="I am yhp！welcome to my home!";
if ($bar = ~ m/yhp/ ) { # m// => match/ /
    print("1：匹配\n");
} else {
    print("1:不匹配\n");
}

$string = "welcome to runoob site.";
$string =~ m/run/;
print("匹配前的字符串:$`\n"); # welcome to
print("匹配的字符串:$&\n"); # run
print("匹配后的字符串:$'\n");# oob site.

# 替换操作
$string = "welcome To runoob site.";
$string =~ s/to/ok/i; # =~ 这两个字符是连在一起的！ 参数i忽略大小写
print("$string\n"); # welcome ok runoob site.

# 转化操作
$string = 'welcome to runoob site.';
$string =~ tr/a-z/A-z/; #小写转大写
print ("$string\n");



